import React, {Component} from 'react'
import '../sass/Gift.scss'

export default class Gift extends Component {
  constructor() {
    super()
  }

  render() {
    let {items, chooseGifts, hideGift} = this.props

    return (
        <div className="gift-select">
            <div className="gift-select-layout" onClick={hideGift.bind(this)}></div>
            <div className="gift-select-box">
                {
                    items.gifts.map((item, index) =>
                        <div className="gift-select-box-item" onClick={chooseGifts.bind(this, {type: 2, goodsId: item.goodsId, activityId: items.activityId})} key={index}>
                            <img src={item.middleImage ? item.middleImage : require('../images/goods_default.png')} alt={item.goodsName}/>
                            <p className="name">{item.name}</p>
                            {item.choose && <i className="iconfont icon-shangpinxuankuang-xuanqu"/>}
                        </div>
                    )
                }
            </div>
        </div>
    )
  }
}
